home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_a / macros.doc < prev    next >
Text File  |  1995-04-22  |  19KB  |  925 lines

  1.  
  2.     Macro library usage definitions 
  3.     Page 1 
  4.  
  5.  
  6.      
  7.      
  8.                                  MACRO usages 
  9.      
  10.      
  11.      
  12.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  13.                            *   Data placement      * 
  14.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  15.      
  16.      
  17.     MEM 
  18.     Developmental ORG 
  19.      
  20.     [When developing programs that will  run in 16K, it is  advantageous to 
  21.     locate them above  DOS (typically  $4000 to $7FFF)  although they  will 
  22.     ultimately run  at around  $600 or  so. This  makes it  easier to  load 
  23.     modules to  be written  to  boot disks  etc. without  using  a separate 
  24.     utility.] 
  25.      
  26.     During development, set OFFSET = $4000 and DEVELOP  = OFFSET. This will 
  27.     put code in high  memory and execute it  there. On the final  assembly, 
  28.     set DEVELOP = 0. This will assemble code  as though it would run in low 
  29.     memory, but write  the binary file  to load the  program image to  high 
  30.     memory. 
  31.      
  32.     Usage: 
  33.              MEM       address 
  34.      
  35.     Example: 
  36.              MEM       $800 
  37.      
  38.     yields: 
  39.       given:(DEVELOP = $4000) 
  40.             (OFFSET = 0) 
  41.      
  42.              ORG       $4800 
  43.              LOC       $800 
  44.      
  45.      
  46.     USEBEG 
  47.     My "USE" 
  48.      
  49.     [The AMAC USE command simply doesn't work. This  crude kludge saves the 
  50.     current LOC and ORG counters to allow temporary  re-placement of inline 
  51.     code. This  uses the  MEM  macro to  update ORG  and  LOC according  to 
  52.     developmental variables. Also uses  local labels, so USEBEG  and USEEND 
  53.     must both reside in the same PROC module, and cannot be nested.] 
  54.      
  55.     Usage: 
  56.              USEBEG    address 
  57.      
  58.     Example: 
  59.              USEBEG    $3000 
  60.      
  61.     yields: 
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.     Macro library usage definitions 
  69.     Page 2 
  70.  
  71.  
  72.      
  73.     :otmp    SET       *O 
  74.     :ltmp    SET       *L 
  75.              MEM       $3000 
  76.      
  77.      
  78.     USEEND 
  79.     Recovery from USEBEG 
  80.      
  81.     Restores ORG and LOC counters after temporary resetting via USEBEG. 
  82.      
  83.     Usage: 
  84.              USEEND    (no operand) 
  85.      
  86.     Produces: 
  87.              ORG       :otmp 
  88.              LOC       :ltmp 
  89.      
  90.      
  91.      
  92.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  93.                            *   8-bit arithmetic    * 
  94.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  95.      
  96.      
  97.     ADD 
  98.     Add WITHOUT carry 
  99.      
  100.     Usage: 
  101.              ADD       #constant 
  102.              ADD       address 
  103.              ADD       address,X 
  104.              ADD       address,Y 
  105.      
  106.     Example: 
  107.              ADD       TROGS,Y 
  108.      
  109.     yields: 
  110.              CLC 
  111.              ADC       TROGS,Y 
  112.      
  113.      
  114.     SUB 
  115.     Subtract WITHOUT carry 
  116.      
  117.     Usage: 
  118.              SUB       #constant 
  119.              SUB       address 
  120.              SUB       address,X 
  121.              SUB       address,Y 
  122.      
  123.     Example: 
  124.              SUB       #$30 
  125.      
  126.     yields: 
  127.              SEC 
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.     Macro library usage definitions 
  135.     Page 3 
  136.  
  137.  
  138.              SBC       #$30 
  139.      
  140.      
  141.     DIV 
  142.     Divide A by a power of 2 
  143.      
  144.     Usage:   DIV       power of 2 
  145.      
  146.     Example: 
  147.              DIV       8 
  148.      
  149.     yields: 
  150.              LSR       A 
  151.              LSR       A 
  152.              LSR       A 
  153.      
  154.      
  155.     MUL 
  156.     Multiply A by a power of 2 
  157.      
  158.     Usage:   MUL       power of 2 
  159.      
  160.     Example: 
  161.              MUL       16 
  162.      
  163.     yields: 
  164.              ASL       A 
  165.              ASL       A 
  166.              ASL       A 
  167.              ASL       A 
  168.      
  169.      
  170.     BMP 
  171.     Add constant to byte at address 
  172.      
  173.     Usage:   BMP       address,constant 
  174.              BMP       address,X,constant 
  175.              BMP       address,Y,constant 
  176.      
  177.     Example: 
  178.              BMP       BORT,125 
  179.      
  180.     yields: 
  181.              LDA       BORT 
  182.              CLC 
  183.              ADC       #125 
  184.              STA       BORT 
  185.      
  186.      
  187.     BAK 
  188.     Subtract constant from byte at address 
  189.      
  190.     Usage:   BAK       address,constant 
  191.              BAK       address,X,constant 
  192.              BAK       address,Y,constant 
  193.      
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.     Macro library usage definitions 
  201.     Page 4 
  202.  
  203.  
  204.     Example: 
  205.              BAK       GLERX,Y,$42 
  206.      
  207.     yields: 
  208.              LDA       GLERX,Y 
  209.              SEC 
  210.              SBC       #$42 
  211.              STA       GLERX,Y 
  212.      
  213.      
  214.      
  215.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  216.                            *   16-bit arithmetic   * 
  217.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  218.      
  219.      
  220.     ADW 
  221.     Add two words at addresses and store at a third 
  222.      
  223.     Usage:   ADW       address 1,address 2,dest. address 
  224.      
  225.     Example: 
  226.              ADW       WREG,TEDUK,WREG 
  227.      
  228.     yields: 
  229.              LDA       WREG 
  230.              CLC 
  231.              ADC       TEDUK 
  232.              STA       WREG 
  233.              LDA       WREG+1 
  234.              ADC       TEDUK+1 
  235.              STA       WREG+1 
  236.      
  237.      
  238.     SBW 
  239.     Subtract two words at addresses and store at a third 
  240.      
  241.     Usage:   SBW       address 1,address 2,dest. address 
  242.      
  243.     Example: 
  244.              SBW       VEP,QWERTY,GADS 
  245.      
  246.     yields: 
  247.              LDA       VEP 
  248.              SEC 
  249.              SBC       QWERTY 
  250.              STA       GADS 
  251.              LDA       VEP+1 
  252.              SBC       QWERTY+1 
  253.              STA       GADS+1 
  254.      
  255.      
  256.     BMPW 
  257.     Add a constant to a word at address 
  258.      
  259.     Usage:   BMPW      address,constant 
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.     Macro library usage definitions 
  267.     Page 5 
  268.  
  269.  
  270.      
  271.     Example: 
  272.              BMPW      KLUT,$4258 
  273.      
  274.     yields: 
  275.              LDA       KLUT 
  276.              CLC 
  277.              ADC       #$58 
  278.              STA       KLUT 
  279.              LDA       KLUT+1 
  280.              ADC       #$42 
  281.              STA       KLUT+1 
  282.      
  283.      
  284.     BAKW 
  285.     Subtract a constant from a word at address 
  286.      
  287.     Usage:   BAKW      address,constant 
  288.      
  289.     Example: 
  290.              BAKW      NATHIL,HPOS 
  291.      
  292.     yields: 
  293.              LDA       NATHIL 
  294.              SEC 
  295.              SBC       #LOW HPOS 
  296.              STA       NATHIL 
  297.              LDA       NATHIL+1 
  298.              SBC       #HIGH HPOS 
  299.              STA       NATHIL+1 
  300.      
  301.      
  302.     INW 
  303.     Increment a word at address 
  304.      
  305.     Usage:   INW       address 
  306.      
  307.     Example: 
  308.              INW       GOLD 
  309.      
  310.     yields: 
  311.              INC       GOLD 
  312.              BNE       LABEL 
  313.              INC       GOLD+1 
  314.     LABEL    =         * 
  315.      
  316.      
  317.     DEW 
  318.     Decrement a word at address 
  319.      
  320.     Usage:   DEW       address 
  321.      
  322.     Example: 
  323.              DEW       ZUGG 
  324.      
  325.     yields: 
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.     Macro library usage definitions 
  333.     Page 6 
  334.  
  335.  
  336.              LDA       ZUGG 
  337.              BNE       LABEL 
  338.              DEC       ZUGG+1 
  339.     LABEL    DEC       ZUGG 
  340.      
  341.      
  342.      
  343.                           *=*=*=*=*=*=*=*=*=*=*=*=*=* 
  344.                           *   Conditional branches  * 
  345.                           *=*=*=*=*=*=*=*=*=*=*=*=*=* 
  346.      
  347.      
  348.     Usage for all branch instructions: 
  349.              XXX       address 
  350.      
  351.      
  352.     BGE 
  353.     Branch on Greater than or Equal to 
  354.      
  355.     BGT 
  356.     Branch on Greater than 
  357.      
  358.     BLE 
  359.     Branch on Less than or Equal to 
  360.      
  361.     BLT 
  362.     Branch on Less than 
  363.      
  364.     BNZ 
  365.     Branch on Non Zero 
  366.      
  367.     BZ 
  368.     Branch on Zero 
  369.      
  370.      
  371.      
  372.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  373.                            *   Conditional jumps   * 
  374.                            *=*=*=*=*=*=*=*=*=*=*=*=* 
  375.      
  376.      
  377.     Usage for all jump instructions: 
  378.              XXX       address 
  379.      
  380.      
  381.     JMI 
  382.     Jump on Minus 
  383.      
  384.     JPL 
  385.     Jump on Plus 
  386.      
  387.     JCS 
  388.     Jump on Carry Set 
  389.      
  390.     JCC 
  391.     Jump on Carry Clear 
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.     Macro library usage definitions 
  399.     Page 7 
  400.  
  401.  
  402.      
  403.     JGE 
  404.     Jump on Greater than or Equal to 
  405.      
  406.     JGT 
  407.     Jump on Greater than 
  408.      
  409.     JLE 
  410.     Jump on Less than or Equal to 
  411.      
  412.     JLT 
  413.     Jump on Less than 
  414.      
  415.     JNE 
  416.     Jump on Not Equal 
  417.      
  418.     JNZ 
  419.     Jump on Non Zero 
  420.      
  421.     JEQ 
  422.     Jump on Equal to 
  423.